import turtle
pos=[0,0]
direction=0
def snake():
    turtle.clear()
    turtle.up()
    turtle.goto(pos)
    turtle.down()
    turtle.dot(20,'cyan')
    if direction==0:
        pos[0]-=10
    elif direction==1:
        pos[0]+=10
    elif direction==2:
        pos[1]+=10
    else:
        pos[1]-=10
    turtle.ontimer(snake,500)

turtle.tracer(False)
snake()
turtle.done()

